/*
package com.itheima.oneToOne.impl;

import Student;
import com.itheima.oneToOne.StudentMapper;
import MyBatisUtils;
import org.apache.ibatis.session.SqlSession;

import java.util.List;
*/
/*
    持久层实现类
 *//*

public class StudentMapperImpl implements StudentMapper {

    */
/*
        查询全部
     *//*

    @Override
    public List<Student> selectAll() {

        SqlSession sqlSession = MyBatisUtils.getSqlSession();
        List<Student> list = sqlSession.selectList("StudentMapper.selectAll");
        sqlSession.close();
        return  list;
    }

    */
/*
    根据name查询
 *//*

    @Override
    public List<Student> selectByName(String name) {
        SqlSession sqlSession = MyBatisUtils.getSqlSession();
        //4.执行映射配置文件中的sql语句，并接收结果
        List<Student> list = sqlSession.selectList("StudentMapper.selectByName", name);
        sqlSession.close();
        //6.返回结果
        return list;
    }

    */
/*
        根据id查询
     *//*

    @Override
    public Student selectById(Integer id) {
        SqlSession sqlSession = MyBatisUtils.getSqlSession();
        //4.执行映射配置文件中的sql语句，并接收结果
         Student   stu = sqlSession.selectOne("StudentMapper.selectById",id);
        sqlSession.close();
        //6.返回结果
        return stu;
    }

    */
/*
        新增功能
     *//*

    @Override
    public Integer insert(Student stu) {
        SqlSession sqlSession = MyBatisUtils.getSqlSession();
        //4.执行映射配置文件中的sql语句，并接收结果
        int result = sqlSession.insert("StudentMapper.insert", stu);
        sqlSession.close();
        return result;
    }

    */
/*
        修改功能
     *//*

    @Override
    public Integer update(Student stu) {

        SqlSession sqlSession = MyBatisUtils.getSqlSession();
        //4.执行映射配置文件中的sql语句，并接收结果
        int result = sqlSession.update("StudentMapper.update", stu);
        sqlSession.close();
        //6.返回结果
        return result;
    }

    */
/*
        删除功能
     *//*

    @Override
    public Integer delete(Integer id) {
        SqlSession sqlSession = MyBatisUtils.getSqlSession();
        //4.执行映射配置文件中的sql语句，并接收结果
          int  result = sqlSession.delete("StudentMapper.delete",id);
        sqlSession.close();
        //6.返回结果
        return result;
    }
}
*/
